function clearTextArea() {
      document.getElementById("target-textarea").value = '';
    }

    function $(id) {
      return document.getElementById(id)
    }
    var char2entity = {
      "'": '&#39;',
      '"': '&quot;',
      '<': '&lt;',
      '>': '&gt;',
      '&': '&amp;'
    };

    function encode_entities(str) {
      var rv = '';
      for (var i = 0; i < str.length; i++) {
        var ch = str.charAt(i);
        rv += char2entity[ch] || ch;
      }
      return rv;
    }

    function do_encode(e) {
      $('dst').value = encode_entities(e.value)
    }
	function goBack()
    {
    window.history.back()
    }
    // Mendukung untuk semua peramban mayor dan IE8+
function wrapText(str1, str2, elem) {
    var value = elem.value,
        before = value.substring(0, elem.selectionStart),
        selected = value.substring(elem.selectionStart, elem.selectionEnd),
        after = value.substring(elem.selectionEnd, value.length),
        pos = before.length + str1.length + selected.length + str2.length;
    elem.value = before + str1 + selected + str2 + after;
    setSelectionRange(elem, before.length, pos);
}

// http://stackoverflow.com/a/499158
function setSelectionRange(input, selectionStart, selectionEnd) {
    if (input.setSelectionRange) {
        input.focus();
        input.setSelectionRange(selectionStart, selectionEnd);
    } else if (input.createTextRange) {
        var range = input.createTextRange();
        range.collapse(true);
        range.moveEnd('character', selectionEnd);
        range.moveStart('character', selectionStart);
        range.select();
    }
}